class Solution(object):
    def game(self, guess, answer):
        """
        :type guess: List[int]
        :type answer: List[int]
        :rtype: int
        """
        return sum([a == b for a,b in zip(guess, answer)]) # zip是将guess和answer的元素一一对应,形成一个新的由元组组成的迭代器，[(1,1),(2,2),(3,3)]
if __name__ == '__main__':
    guess = [1,2,3]
    answer = [1,2,3]
    print(Solution().game(guess, answer))
# 思路：
# 1. 遍历guess和answer的元素，如果相等，则计数器加1
# 2. 返回计数器
# 3. 时间复杂度O(n)
# 4. 空间复杂度O(1)